import React, { Component } from "react";
import request from "../../utils/request";

export default class UseAxios extends Component {
  state = {
    phone: "",
  };
  get_weather = () => {
    const { phone } = this.state;
    request({
      url: "/api/phone/phone.php?phone=" + phone,
      timeout: 1000 * 10,
    })
      .then((res) => {
        console.log(res);
      })
      .catch((error) => {
        console.error(error);
      });
  };
  render() {
    return (
      <div>
        <span>手机号</span>
        <input
          type="text"
          onChange={(e) => {
            this.setState({ phone: e.target.value });
          }}
        />
        <button onClick={this.get_weather.bind(this)}>获取骚扰信息</button>
        <table></table>
      </div>
    );
  }
}
